import { http } from "@/utils/http";
import type { ResultProps } from "@/api/user";

export interface MaterialListProp {
  forced_clean: boolean;
  id: number;
  material_id: string;
  account_id: number;
  business_id: number;
  name: string;
  note: string;
  standard_amount: null;
  amount_unit: string;
  barcode: string;
  use_barcode: boolean;
  delete_status: number;
  publish_status: number;
  type_id: number | null;
  clean_time: number;
  overdue_time: number;
  cold_time: number | null;
  update_time: Date;
  create_time: Date;
  device_type: string;
  device_t: string[];
  spec: null | string;
  material_config: string;
  matConfig: {
    forced_clean: string;
  };
  type_name: null | string;
  index: null;
}

export const getMaterialList = (data?: object) => {
  return http.request<ResultProps<MaterialListProp[]>>(
    "post",
    "/material/getMaterialList",
    {
      data
    }
  );
};

export interface MaterialTypeListProp {
  id: number;
  account_id: number;
  business_id: number;
  name: string;
  note: string;
  delete_status: number;
  update_time: Date;
  create_time: Date;
}

export const getMaterialTypeList = (data?: object) => {
  return http.request<ResultProps<MaterialTypeListProp[]>>(
    "post",
    "/materialType/getMaterialTypeList",
    {
      data
    }
  );
};
